<% if mobile? %>
  <% content_for :mobile_menu do %>
  <a href=""></a>
  <% end %>
  <% content_for :app_back do %>
    <a href="javascript:void(0)" onclick="history.go(-1)">
      <i class="icon-arrow-left"></i>
    </a>
  <% end %>
  <% content_for :app_title do %>
    门窗百科
  <% end %>
  <% content_for :app_action do %>
  <a href=""></a>
  <% end %>

  <div class="mobile-wiki-show">
      <hr class="line">

      <article>
        <h1><%= @wiki.title %></h1>
        <h2>
          <span class="text-gray"><%= @wiki.publish_time.to_date.to_s(:db) %></span>
          <span class="text-green">出自：<%= @wiki.source %></span>
        </h2>
        <div class="article-content">
          <%= sanitize @wiki.content, tags: %w(p strong em span), attributes: %w(style) %>
        </div>
      </article>
  </div>

<% else %>

<% breadcrumb :wiki, @wiki %>
<div class="wiki-show">
  <div class="row">
    <div class="col-xs-1">
        <div class="article-tag pull-right">
          阳毅
          <br>
          原创
        </div>
    </div>

    <div class="col-xs-7">
      <div class="page-header">
        <h1 class="title"><%= @wiki.title %></h1>
        <span class="source">来源：<%= @wiki.source %></span>
        <span><%= @wiki.publish_time.to_date.to_s(:db) %></span>
      </div>
      <div class="page-content">
          <% if @wiki.summary.present? %>
            <div class="summary"><%= @wiki.summary %></div>
          <% end %>
          <%#= sanitize @wiki.content %>
          <%= sanitize @wiki.content, tags: %w(p img em strong span embed), attributes: %w(src style width height class) %>

          <div class="row margin-reset">
            <div class="pull-right">
              <%= render partial: 'shared/sharing' %>
            </div>
          </div>
      </div>

      <hr>

      <div class="row margin-reset page-footer">
        <div class="col-xs-12 padding-reset footer-link">
          <% if @last %>
            <a href="<%= wiki_path(@last) %>" title="<%= @last.title %>"><small>上一篇：<%= @last.title %></small></a>
          <% end %>
        </div>
        <div class="col-xs-12 padding-reset footer-link">
          <% if @next %>
            <a href="<%= wiki_path(@next) %>" title="<%= @next.title %>"><small>上一篇：<%= @next.title %></small></a>
          <% end %>
        </div>
      </div>

    </div>

    <div class="col-xs-3">
      <% if @related.present? %>
      <div class="row margin-reset other-article">
        <h4>相关文章</h4>
        <div class="col-xs-12">
          <ul>
            <% @related.each do |relate| %>
            <li>
              <a href="<%= wiki_path(relate) %>" title="<%= relate.title %>"><%= relate.title %></a>
              <br>
              <span class="date"><%= relate.publish_time.to_date.to_s(:db) %></span>
            </li>
            <% end %>
          </ul>
        </div>
      </div>
      <% end %>

      <% if @wiki.tag_list.present? %>
      <div class="row margin-reset key-tag">
        <h3 class="key-tag-title">关键字</h3>
        <div class="tag-list">
          <% @wiki.tag_list.each do |tag| %>
            <label><%= tag %></label>
          <% end %>
        </div>
      </div>
      <% end %>

      <div class="row margin-reset activity">
        <h4 class="activity-title">相关活动</h4>

        <% @sales_promotions.each do |promotion| %>
        <div class="activity-item">
          <a href="<%= promotion_path(promotion) %>" target="_blank">
            <% unless promotion.main_img %>
              <div class="none">无促销图片</div>
            <% else %>
              <%= image_tag promotion.main_img %>
            <% end %>
            <h5 class="cut-title">
              <%= promotion.title %>
            </h5>
          </a>
        </div>
        <% end %>

      </div>
    </div>
  </div>
</div>
<% end %>
